package demo;

/**
 * @program: jmm
 * @description:
 * @author: zhanghz001
 * @create: 2020-12-29 15:55
 **/
public class ForverRunTest {
    static boolean stop = true;
    
    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            System.out.println("开始循环");
            while (stop) {
            }
            System.out.println("结束循环");
        }).start();
        Thread.sleep(1000);
        new Thread(() -> {
            System.out.println("开始修改stop的值");
            stop = false;
            System.out.println("stop已经修改了");
        }).start();
    }
}
